<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>

<body>
<script>

var r = new RegExp("\\b\\w","gi");		// 构造正则表达式对象
var s = "javascript JAVA";				// 字符串直接量
var a = s.match(r); 					// 匹配查找
alert(a); 								// 返回数组["j", "J"]



</script>
</body>
</html>
